package com.czy.controller;

import com.czy.pojo.CountOption;
import com.czy.pojo.JobOption;
import com.czy.pojo.Result;
import com.czy.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 图形报表Controller
 */
@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;

    /**
     * 统计员工职位人数
     */
    @GetMapping("/empJobData")
    public Result getEmpJobData() {
        log.info("统计员工职位人数");
        JobOption jobOption = reportService.getEmpJobData();
        return Result.success(jobOption);
    }

    /**
     * 根据员工性别统计人数
     */
    @GetMapping("/empGenderData")
    public Result getGenderData() {
        log.info("根据员工性别统计人数");
        List<Map<String, Object>> genderList = reportService.getGenderData();
        return Result.success(genderList);
    }

    /**
     * 统计学员学历人数
     */

    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData() {
        log.info("统计学员学历人数");
        List<Map<String, Object>> degreeList = reportService.getDegreeData();
        return Result.success(degreeList);
    }

    /**
     * 统计班级人数
     */
    @GetMapping("/studentCountData")
    public Result getStudentCountData(){
        log.info("统计班级人数");
        CountOption countData = reportService.getStudentCountData();
        return Result.success(countData);
    }


}
